package com.fm.openinstall.b;

import java.io.*;
import android.text.*;
import org.json.*;

public class b implements Serializable
{
    private Boolean a;
    private Boolean b;
    private Boolean c;
    private Long d;
    private String e;

    public b() {
        this.a = null;
        this.b = null;
        this.c = null;
        this.d = null;
        this.e = "";
    }

    public static b a(final String s) {
        final b b = new b();
        if (TextUtils.isEmpty((CharSequence)s)) {
            return b;
        }
        final JSONObject jsonObject = new JSONObject(s);
        if (jsonObject.has("wakeupStatsEnabled")) {
            b.a(jsonObject.optBoolean("wakeupStatsEnabled", true));
        }
        if (jsonObject.has("aliveStatsEnabled")) {
            b.c(jsonObject.optBoolean("aliveStatsEnabled", true));
        }
        if (jsonObject.has("registerStatsEnabled")) {
            b.b(jsonObject.optBoolean("registerStatsEnabled", true));
        }
        if (jsonObject.has("eventStatsEnabled")) {
            b.c(jsonObject.optBoolean("eventStatsEnabled", true));
        }
        if (jsonObject.has("reportPeriod")) {
            b.a(jsonObject.optLong("reportPeriod"));
        }
        if (jsonObject.has("installId")) {
            b.b(jsonObject.optString("installId"));
        }
        return b;
    }

    private boolean d(final Boolean b) {
        return b != null && b;
    }

    public Boolean a() {
        return this.a;
    }

    public void a(final Boolean a) {
        this.a = a;
    }

    public void a(final Long d) {
        this.d = d;
    }

    public void b(final Boolean b) {
        this.b = b;
    }

    public void b(final String e) {
        this.e = e;
    }

    public boolean b() {
        return this.d(this.a);
    }

    public Boolean c() {
        return this.b;
    }

    public void c(final Boolean c) {
        this.c = c;
    }

    public Boolean d() {
        return this.c;
    }

    public boolean e() {
        return this.d(this.c);
    }

    public boolean f() {
        return this.d(this.b);
    }

    public Long g() {
        return this.d;
    }

    public String h() {
        return this.e;
    }

    public String i() {
        final JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("wakeupStatsEnabled", (Object)this.a);
            jsonObject.put("registerStatsEnabled", (Object)this.b);
            jsonObject.put("eventStatsEnabled", (Object)this.c);
            jsonObject.put("reportPeriod", (Object)this.d);
            jsonObject.put("installId", (Object)this.e);
            return jsonObject.toString();
        }
        catch (JSONException ex) {
            return jsonObject.toString();
        }
    }
}
